<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.2</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <#include "/comm/module.ftl"/>
    <script type="text/javascript" src="${request.contextPath}/assets/js/module-edit.js?${(.now)!}"></script>
    <style type="text/css">
        .layui-form-item .layui-input-inline {
            min-width: 230px;
        }

        .layui-form-item .layui-input-block {
            min-width: 230px;
        }

        .layui-form-radio {
            padding-right: 0;
        }
    </style>
</head>

<body>
<div class="layui-div-body">
    <#--    <div class="x-nav">-->
    <#--          <span class="layui-breadcrumb">-->
    <#--            <a href="">首页</a>-->
    <#--            <a href="">基础管理</a>-->
    <#--            <a>-->
    <#--              <cite>属性配置</cite></a>-->
    <#--          </span>-->
    <#--    </div>-->
    <div class="layui-fluid layui-div-edit">
        <form class="layui-form layui-form-pane">
            <div class="layui-form-item">
                <label class="layui-form-label">类型</label>
                <div class="layui-input-block">
                    <input type="radio" name="ppType" value="MENU"
                           title="菜单" <#if info.ppType =='MENU'> checked </#if>>
                    <input type="radio" name="ppType" value="BUTTON"
                           title="按钮" <#if info.ppType =='BUTTON'> checked </#if>>
                    <input type="radio" name="ppType" value="VIEWS"
                           title="链接" <#if info.ppType =='VIEWS'> checked </#if>>

                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">父级菜单</label>
                <div class="layui-input-inline">
                    <div id="ppParent" initValue="${info.ppParent!}"></div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">编码</label>
                <div class="layui-input-inline">
                    <#if info._id !=''>
                        <input type="text" name="ppCode" value="${info.ppCode!}"
                               placeholder="请输入编码" class="layui-input" disabled>
                    <#else>
                        <input type="text" name="ppCode" lay-verify="required" value=""
                               placeholder="请输入编码" class="layui-input" lay-reqtext="请填写编码">
                    </#if>

                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">名称</label>
                <div class="layui-input-inline">
                    <input type="text" name="ppName" lay-verify="required" value="${info.ppName!}"
                           placeholder="请输入名称" class="layui-input" lay-reqtext="请填写名称">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">权限标识</label>
                <div class="layui-input-inline">
                    <input type="text" name="ppAuth" value="${info.ppAuth!}"
                           placeholder="请输入名称" class="layui-input" lay-reqtext="请填写名称">
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">图标</label>
                    <div class="layui-input-inline">
                        <input type="text" name="ppIcon"
                               placeholder="请输入图标" value="${info.ppIcon!}"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">排序</label>
                    <div class="layui-input-inline">
                        <input type="number" name="ppSort"
                               placeholder="请输入数值" lay-affix="number" min="0" step="1" value="${info.ppSort!1}"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">是否显示</label>
                    <div class="layui-input-block">
                        <input type="radio" name="ppDisplay" value="0"
                               title="否" <#if info.ppDisplay <=0> checked </#if>>
                        <input type="radio" name="ppDisplay" value="1"
                               title="是" <#if info.ppDisplay==1> checked </#if>>
                    </div>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">备注</label>
                <div class="layui-input-block">
                    <textarea name="conteppRemark" placeholder="请输入备注"
                              class="layui-textarea">${info.ppRemark!}</textarea>
                </div>
            </div>
            <div class="layui-form-item" style="left: 0">
                <input type="hidden" id="_id" name="_id" value="${info._id}"/>
                <div class="layui-footer">
                    <button class="layui-btn" lay-submit="" lay-filter="save">立即提交
                    </button>
                    <#if info._id ==''>
                        <button type="reset" class="layui-btn layui-btn-primary" id="btn-reset">重置</button>
                    </#if>
                </div>
            </div>


        </form>
    </div>
</div>
<script>
    layui.config({
        base: '${request.contextPath}/assets/lib/' //静态资源所在路径
    }).extend({
        combotree: 'combotree',
        edit: 'edit',
    });
    layui.use(['edit', 'combotree'], function () {
        let edit = layui.edit, $ = layui.$, combotree = layui.combotree;
        edit.render()
        combotree.render({
            id: 'ppParent',
            elem: '#ppParent',
            isMultiple: false,
            expandLevel: 2,
            yChkboxType: 's',
            nChkboxType: 's',
            ajaxUrl: "${request.contextPath}/platform/permission/tree",
            placeholder: "请选择父级节点",
            // layVerify: 'required'
        });
        $('#btn-reset').on('click', function () {
            combotree.setValue('parent_code', "")
        });

    });
</script>
</body>

</html>